<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="/WEB-INF/struts-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">


 function accion(){
	document.forms[0].method.value='votar';	
	document.forms[0].submit(); 
 }
 function limpiar(cual, accion){
	// Action: 0=Deseleccionar todos 1=Seleccionar todos -1=Invertir seleccion
		var f = document.forms[0];
		for (var i=0; i<f.elements.length; i++){
			var obj = f.elements[i];
			var name = obj.name;
			if (name==cual){
				obj.checked = ((accion==1)? true : ((accion==0)? false : !obj.checked) );
			}
		}
	}

  
 function changeStyle(tableID,rowNumber,styleCellSelected,styleCellEven,styleCellOdd,type){
	var theTable = document.getElementById(tableID);
	var theRow = theTable.rows[rowNumber];
	//type==1 MultipleSelection
	if(type==1){
		for(r = 0; r < theRow.cells.length; r++){
			if(theRow.cells[r].className==styleCellSelected){
				if(mod(rowNumber,2)==0)theRow.cells[r].className=styleCellEven;
				else theRow.cells[r].className=styleCellOdd;
			}
			else theRow.cells[r].className=styleCellSelected;
		}
	}else{
		for(j = 0; j < theRow.cells.length; j++) theRow.cells[j].className=styleCellSelected;
		for (i = 1; i < theTable.rows.length; i++) {
			if(i != rowNumber ) {
				rowEl = theTable.rows[i];
				for(c = 0; c < rowEl.cells.length; c++) {
					if(mod(i,2)==0)
						rowEl.cells[c].className=styleCellEven;
					else
						rowEl.cells[c].className=styleCellOdd;
					}
				}
			}
		} 
	}
	function mod(a,b){
		return a - Math.floor(a / b) * b;
	}
</script>
</head>
<body>
<center>
  <div class="titulo" >Resultados Elecciones Generales 2008</div>  
<html:form action="resultado.do" method="POST"  >
 <input type="hidden" name="method"/>  
<display:table name="${listResultado}" id="beanResultado"
	class="table" pagesize="15" style="height:16px;width:60%"
	 cellspacing="0" cellpadding="0">
	 
	<display:column headerClass="table-head"  style="width:100px;align:center" 
		title="Candidato">
		<center>
		<table>
		   <tr>
		        
				<td>
		      ${beanResultado.nombreCandidato}
		      </td>
		    </tr>
		   </table>
		   </center>   
	</display:column>
	<display:column headerClass="table-head" style="width:100px;align:center"
		title="Partido Politico">
		<center>
			<table>
			   <tr>   
					<td>
						${beanResultado.nombrePartido}
			        </td>
		    	</tr>
		   	</table>
		   </center>   
	</display:column>
	 <display:column headerClass="table-head" style="width:100px;align:center" property="cantidadVotos"
		title="Votos"/>
		<display:column headerClass="table-head" style="width:100px;align:center"  
		title="Porcentaje">
		 ${beanResultado.porcentajeVotos} %
		</display:column>
</display:table>
 
</html:form>
</center>
</body>
</html>